package myTeam.timeShop.bean;

// Generated 2016-3-28 15:20:15 by Hibernate Tools 3.2.2.GA

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.NamedQueries;
import org.hibernate.annotations.NamedQuery;

import com.alibaba.fastjson.annotation.JSONField;
@NamedQueries({
	@NamedQuery(name="getAllMyNoSeeComment" ,query="from TbComment c where c.tbDemand.tbUserByDemandUserId.userId = ? and c.commentIsSaw=0 "),

})
/**
 * Entity: 
 */
@Entity
@Table(name = "tb_comment", catalog = "db_timeshop")
public class TbComment implements java.io.Serializable {

	/** 
	 * ����id.
	 */

	private Integer commentId;

	/** 
	 * ����id.
	 */

	private TbDemand tbDemand;

	/** 
	 * ���۸�id.
	 */

	private TbComment tbComment;

	/** 
	 * �û�id.
	 */

	private TbUser tbUser;

	/** 
	 * ��������.
	 */

	private String commentContent;

	/** 
	 * ����ʱ��.
	 */

	private Date commentTime;

	/** 
	 * �Ķ�״̬��0����δ����1�����Ѷ���.
	 */

	private Integer commentIsSaw;

	private Set<TbComment> tbComments = new HashSet<TbComment>(0);

	private Set<TbComment> tbComments_1 = new HashSet<TbComment>(0);

	public TbComment() {
	}

	public TbComment(TbDemand tbDemand, TbUser tbUser) {
		setTbDemand(tbDemand);
		setTbUser(tbUser);
	}

	public TbComment(TbDemand tbDemand, TbComment tbComment, TbUser tbUser,
			String commentContent, Date commentTime, Integer commentIsSaw,
			Set<TbComment> tbComments, Set<TbComment> tbComments_1) {
		setTbDemand(tbDemand);
		setTbComment(tbComment);
		setTbUser(tbUser);
		setCommentContent(commentContent);
		setCommentTime(commentTime);
		setCommentIsSaw(commentIsSaw);
		setTbComments(tbComments);
		setTbComments_1(tbComments_1);
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "comment_id", unique = true, nullable = false)
	public Integer getCommentId() {
		return this.commentId;
	}

	public void setCommentId(Integer commentId) {
		this.commentId = commentId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "comment_demand_id", nullable = false)
	@JSONField(serialize=false)
	public TbDemand getTbDemand() {
		return this.tbDemand;
	}

	public void setTbDemand(TbDemand tbDemand) {
		this.tbDemand = tbDemand;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "comment_parent_id")
	@JSONField(serialize=false)
	public TbComment getTbComment() {
		return this.tbComment;
	}

	public void setTbComment(TbComment tbComment) {
		this.tbComment = tbComment;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "comment_user_id", nullable = false)
	@JSONField(serialize=false)
	public TbUser getTbUser() {
		return this.tbUser;
	}

	public void setTbUser(TbUser tbUser) {
		this.tbUser = tbUser;
	}

	@Column(name = "comment_content", length = 240)
	public String getCommentContent() {
		return this.commentContent;
	}

	public void setCommentContent(String commentContent) {
		this.commentContent = commentContent;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "comment_time", length = 19)
	public Date getCommentTime() {
		return this.commentTime;
	}

	public void setCommentTime(Date commentTime) {
		this.commentTime = commentTime;
	}

	@Column(name = "comment_is_saw")
	public Integer getCommentIsSaw() {
		return this.commentIsSaw;
	}

	public void setCommentIsSaw(Integer commentIsSaw) {
		this.commentIsSaw = commentIsSaw;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbComment")
	@JSONField(serialize=false)
	public Set<TbComment> getTbComments() {
		return this.tbComments;
	}

	public void setTbComments(Set<TbComment> tbComments) {
		this.tbComments = tbComments;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbComment")
	@JSONField(serialize=false)
	public Set<TbComment> getTbComments_1() {
		return this.tbComments_1;
	}

	public void setTbComments_1(Set<TbComment> tbComments_1) {
		this.tbComments_1 = tbComments_1;
	}

}
